home *** CD-ROM | disk | FTP | other *** search
/ The Dynamic Human Version 2.0 / DH2_CD2.ISO / pc / files / index.dxr / 00042_index Actions.ls < prev    next >
Encoding:
Text File  |  1997-11-18  |  5.0 KB  |  160 lines

  1. on indexUpArrowAction
  2.   global indexWindowObject
  3.   indexScrollButtons(the upArrowSprite of indexWindowObject, -1)
  4. end
  5.  
  6. on indexDownArrowAction
  7.   global indexWindowObject
  8.   indexScrollButtons(the downArrowSprite of indexWindowObject, 1)
  9. end
  10.  
  11. on indexScrollButtons whichSprite, whichDirection
  12.   set the castNum of sprite whichSprite to the castNum of sprite whichSprite + 1
  13.   updateStage()
  14.   set buttonDown to 1
  15.   indexScrollWindow(whichDirection)
  16.   set startRect to the rect of sprite whichSprite
  17.   repeat while the mouseDown
  18.     set nextPoint to point(the mouseH, the mouseV)
  19.     if inside(nextPoint, startRect) then
  20.       if not buttonDown then
  21.         set buttonDown to 1
  22.         set the castNum of sprite whichSprite to the castNum of sprite whichSprite + 1
  23.         updateStage()
  24.       end if
  25.       indexScrollWindow(whichDirection)
  26.       next repeat
  27.     end if
  28.     if buttonDown then
  29.       set buttonDown to 0
  30.       set the castNum of sprite whichSprite to the castNum of sprite whichSprite - 1
  31.       updateStage()
  32.     end if
  33.   end repeat
  34.   if buttonDown then
  35.     set buttonDown to 0
  36.     set the castNum of sprite whichSprite to the castNum of sprite whichSprite - 1
  37.     updateStage()
  38.   end if
  39. end
  40.  
  41. on indexSliderAction
  42.   global indexWindowObject
  43.   set sliderSprite to the sliderSprite of indexWindowObject
  44.   set barRect to the barRect of indexWindowObject
  45.   set myTolerance to 0
  46.   puppetSprite(sliderSprite, 1)
  47.   set sliderHeight to the height of sprite sliderSprite
  48.   set mouseMinH to the left of sprite sliderSprite - myTolerance
  49.   set mouseMaxH to the right of sprite sliderSprite + myTolerance
  50.   set mouseMinV to getAt(barRect, 2)
  51.   set mouseMaxV to getAt(barRect, 4)
  52.   set sliderMinV to mouseMinV + (sliderHeight / 2)
  53.   set sliderMaxV to mouseMaxV - (sliderHeight / 2) - 1
  54.   set sliderRange to sliderMaxV - sliderMinV
  55.   set startSliderTop to the top of sprite sliderSprite - mouseMinV - 1
  56.   set currentSliderV to the locV of sprite sliderSprite
  57.   set previousSliderTop to startSliderTop
  58.   repeat while the mouseDown
  59.     set currentH to the mouseH
  60.     set currentV to the mouseV
  61.     if (currentH >= mouseMinH) and (currentH <= mouseMaxH) then
  62.       if (currentV >= sliderMinV) and (currentV <= sliderMaxV) then
  63.         set nextLocV to currentV
  64.       else
  65.         if (currentV >= mouseMinV) and (currentV <= sliderMinV) then
  66.           set nextLocV to sliderMinV
  67.         else
  68.           if (currentV >= sliderMaxV) and (currentV <= mouseMaxV) then
  69.             set nextLocV to sliderMaxV
  70.           else
  71.             set nextLocV to currentSliderV
  72.           end if
  73.         end if
  74.       end if
  75.     else
  76.       set nextLocV to currentSliderV
  77.     end if
  78.     set the locV of sprite sliderSprite to nextLocV
  79.     updateStage()
  80.     set currentSliderTop to nextLocV - sliderMinV - 1
  81.     if currentSliderTop <> previousSliderTop then
  82.       set fractionalDist to float(currentSliderTop) / sliderRange
  83.       indexScrollWindow(fractionalDist, 1)
  84.       set previousSliderTop to currentSliderTop
  85.       updateStage()
  86.     end if
  87.   end repeat
  88. end
  89.  
  90. on indexBarAction
  91.   global indexWindowObject
  92.   set firstTime to 1
  93.   set currentV to the mouseV
  94.   set barSprite to the buttonSprite of indexWindowObject
  95.   set sliderSprite to the sliderSprite of indexWindowObject
  96.   set barRect to the barRect of indexWindowObject
  97.   set myTolerance to 0
  98.   set minV to getAt(barRect, 2)
  99.   set maxV to getAt(barRect, 4)
  100.   set sliderTop to the top of sprite sliderSprite
  101.   set sliderHeight to the height of sprite sliderSprite
  102.   if currentV < (sliderTop + (sliderHeight / 2)) then
  103.     set whichDirection to -1
  104.   else
  105.     set whichDirection to 1
  106.   end if
  107.   repeat while the mouseDown or firstTime
  108.     set sliderTop to the top of sprite sliderSprite
  109.     if inside(point(the mouseH, the mouseV), barRect) then
  110.       if (currentV < sliderTop) and (whichDirection = -1) then
  111.         indexScrollWindow("pageUp")
  112.       else
  113.         if (currentV > (sliderTop + sliderHeight)) and (whichDirection = 1) then
  114.           indexScrollWindow("pageDown")
  115.         end if
  116.       end if
  117.       set currentV to the mouseV
  118.     end if
  119.     set firstTime to 0
  120.   end repeat
  121. end
  122.  
  123. on indexTextAction
  124.   global indexWindowObject, gButCalled, gIndexLine, gIndexTop
  125.   set textField to the textName of indexWindowObject
  126.   set newLine to the mouseLine
  127.   if (newLine <= 0) or (newLine > the number of lines in field textField) then
  128.     return 
  129.   end if
  130.   if length(line newLine of field textField) <= 1 then
  131.     return 
  132.   end if
  133.   hilite line newLine of field textField
  134.   setupLinkButtons(indexWindowObject, newLine)
  135.   set gButCalled to 1
  136.   set gIndexLine to newLine
  137.   set gIndexTop to the scrollTop of member the textName of indexWindowObject
  138. end
  139.  
  140. on indexGotoAction
  141.   global indexWindowObject, gReturnMovie
  142.   set theLine to the currentLine of indexWindowObject
  143.   set theField to the textName of indexWindowObject
  144.   if theLine <= 0 then
  145.     return 
  146.   end if
  147.   set theText to line theLine of field theField
  148.   set movieName to indexGetFileName(theText)
  149.   puppetSound(0)
  150.   updateStage()
  151.   tell the stage
  152.     gomovie(movieName)
  153.   end tell
  154. end
  155.  
  156. on indexGoAction whichOne
  157.   global indexWindowObject
  158.   indGoAction(indexWindowObject, whichOne)
  159. end
  160.